﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<cludg.Web.ViewModels.StoryListModel>" %>
<%@ Import Namespace="cludg.Web.Core.RenderHelpers" %>
<%@ Import Namespace="cludg.Web.RenderHelpers" %>

<% foreach (var story in Model.Stories)
   { %>
<div class="story">
	<% Html.ViewExtensionPlace("Story_List_Content_Before", story); %>
	<% Html.RenderPartial("StoryDetailsControl", story); %>
	<% Html.ViewExtensionPlace("Story_List_Content_After", story); %>

	<br />
	<span class="comments-count-info">
	<%  int commentCount = story.Comments.Count();
		if (commentCount != 0)
		{ %>
		Коменатриев: <%: commentCount %>	 
		<% }  %>
		<% else { %>
		Комментариев нет
		<% }  %>
	</span>
	<br />
	<span class="views-count-info">
	<%  if (story.ViewCount != 0)
		{ %>
		Просмотров: <%: story.ViewCount%>	 
		<% }  %>
		<% else { %>
		Просмотров нет
		<% }  %>
	</span>

	<br />
	<%: Html.StoryLink("подробнее...", story) %>
	</div>
<% } %>

<div class="pages">
<% 
	for (var i = 0; i < Model.PageCount; i++)
	{
		if (i != Model.PageNumber)
		{ %>
			<%
				object routValues = null;
				if (String.IsNullOrEmpty(Model.Tag))
					routValues = new { page = i + 1 };
				else
					routValues = new { page = i + 1, tag = Model.Tag };
			 %>
			<%: Html.ActionLink((i + 1).ToString(), "Index", routValues)%>
		<% }
		else
		{ %>
			<span class="active"><%: (i + 1).ToString() %></span>
		<% }
	
	} %>
</div>